#include "stdio.h"
#include "stdlib.h"

int main() {
    FILE *fp = NULL;
    fp = fopen("test.txt", "w");
    if(NULL == fp) {
        printf("open file error\n");
    }
    char str[10] = "hello\n";
    fprintf(fp, "%s", str);
    fclose(fp);

    fp = fopen("test.txt", "r");
    if(NULL == fp) {
        printf("open file error\n");
    }
    char str2[10];
    fscanf(fp, "%s", str2);
    printf("%s\n", str2);


    return 0;
}